﻿@model PagedList.IPagedList<BanDTBLL.loai_san_pham>
@using PagedList 


@{
    ViewBag.Title = "Danh sách loại sản phẩm";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Danh sách loại sản phẩm</h2>

<p>
    @Html.ActionLink("Thêm loại sản phẩm", "ThemLoaiSanPham")
</p>
<table cellpadding="0" cellspacing="0" width="500">
    <tr>
        <th>
            Mã LSP
        </th>
        <th>
            Tên
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ma)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.tenLoai)
        </td>
        <td>
            @Html.ActionLink("Edit", "EditLSP", new { id = item.ma })
        </td>
    </tr>
}
</table>

<div style="margin-top: 30px;" >
    Trang @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    / @Model.PageCount :
     
    @if (Model.HasPreviousPage)
    {
        
        @Html.ActionLink("Đầu", "ListLoaiSanPham", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { style = "border-style: solid; border-width: 1px; border-color: #000; padding: 5px; margin-left: 5px;" })
        @Html.Raw(" ");
        @Html.ActionLink("Trở lại", "ListLoaiSanPham", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { style = "border-style: solid; border-width: 1px; border-color: #000; padding: 5px; margin-left: 5px;" })
    }
    else
    {
        
        @:Đầu
        @Html.Raw(" ");
        @:Trở lại
    }
     
    @if (Model.HasNextPage)
    {
        @: | 
        @Html.ActionLink("Tiếp theo", "ListLoaiSanPham", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { style = "border-style: solid; border-width: 1px; border-color: #000; padding: 5px; margin-left: 5px;" })
        @Html.Raw(" ");
        @Html.ActionLink("Cuối", "ListLoaiSanPham", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }, new { style = "border-style: solid; border-width: 1px; border-color: #000; padding: 5px; margin-left: 5px;" })
    }
    else
    {
        @: | 
        @:Tiếp theo
        @Html.Raw(" ")
        @:Cuối
    }
</div>
